﻿using System.Runtime.Serialization;
using System.Collections.Generic;
using System;
[DataContract]
public class User
{
    string id;
    decimal money;//돈은 Decimal로...
    ICallback callback;
    [DataMember]
    public string Id
    {
        set { id = value; }
        get { return id; }
    }
    [DataMember]
    public decimal Money
    {
        set { money = value; }
        get { return money; }
    }
    public ICallback Callback
    {
        set { callback = value; }
        get { return callback; }
    }
    private List<Estate> fortunes = new List<Estate>();//부동산
    public bool BuyEstate(Estate estate)//돈에 관련된거만 체크.
    {
        if (money > estate.BuyMoney)
        {

            estate.Onwer = this;
            fortunes.Add(estate);
            money -= estate.BuyMoney;
            return true;
        }
        return false;
    }
    public void SellEstate(Estate estate)
    {
        estate.Onwer = null;
        fortunes.Remove(estate);
        money += estate.SellMoney;
        return;
    }
}
